package Lista;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class ExemploListarActivity extends ListActivity {

	public void onCreate(Bundle icicle){
	super.onCreate(icicle);
	String[] itens = 
			new String [] {"Nome 1","Nome 2","Nome 3","Sair"};
	ArrayAdapter<String>arrayAdapter = 
			new ArrayAdapter<String>(this,
					android.R.layout.simple_list_item_1,itens);
	setListAdapter(arrayAdapter);
			}

	public void onListItemClick(ListView l,View v, int position,long id){
		super.onListItemClick(l,v,position, id);
		Object o = this.getListAdapter().getItem(position);
		String item =		o.toString();
		Toast.makeText(this,"Voce selecionou :"+item, Toast.LENGTH_SHORT).show();
		if (position ==3){
			finish();
		}
	}
	
	
}
